{include file="./layout/header.html" /}
<body>
<div class="x-body" >
    <form class="layui-form" id="intr">

        <div class="layui-form-item">
            <div class="layui-input-inline">
                <input   type="hidden" id="sid" name="sid" required="" lay-verify="required"
                         autocomplete="off" class="layui-input" placeholder="" value='{$sid}'>
            </div>
        </div>

        <div class="layui-form-item">
            <label for="room_number" class="layui-form-label">
                <span class="x-red">*</span>房间数量
            </label>
            <div class="layui-input-inline">
                <input   type="text" id="room_number" name="room_number" required="" lay-verify="required"
                         autocomplete="off" class="layui-input" placeholder="">
            </div>
        </div>

        <div class="layui-form-item">
            <label for="people_number" class="layui-form-label">
                <span class="x-red">*</span>预计可入住人数
            </label>
            <div class="layui-input-inline">
                <input   type="text" id="people_number" name="people_number" required="" lay-verify="required"
                         autocomplete="off" class="layui-input" placeholder="">
            </div>
        </div>

        <div class="layui-form-item">
            <!--<label for="lat" class="layui-form-label">-->
                <!--<span class="x-red">*</span>经度-->
            <!--</label>-->
            <div class="layui-input-inline">
                <input   type="hidden" id="lat" name="lat" required="" lay-verify="required"
                         autocomplete="off" class="layui-input" placeholder="000" value="000">
            </div>
        </div>

        <div class="layui-form-item">
            <!--<label for="lng" class="layui-form-label">-->
                <!--<span class="x-red">*</span>纬度-->
            <!--</label>-->
            <div class="layui-input-inline">
                <input   type="hidden" id="lng" name="lng" required="" lay-verify="required"
                         autocomplete="off" class="layui-input" placeholder="000" value="000">
            </div>
        </div>

        {foreach $lang.hy as $vo}
        <div class="layui-form-item">
            <label for="['{$vo.lan}']['title']" class="layui-form-label">
                <span class="x-red">*</span>{$vo.title}
            </label>
            <div class="layui-input-inline">
                <input   type="text" id="['{$vo.lan}']['title']" name="translations[{$vo.lan}][title]" required="" lay-verify="required"
                         autocomplete="off" class="layui-input" placeholder="">
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label for="['{$vo.lan}']['content']" class="layui-form-label">
                <span class="x-red">*</span>{$vo.content}
            </label>
            <div class="layui-input-block">
                <textarea style="padding:0px" placeholder="请输入内容" id="['{$vo.lan}']['content']" name="translations[{$vo.lan}][content]" class="layui-textarea"></textarea>
            </div>
        </div>
        {if condition="$vo.lan eq 'en'"}
        <!-- 实例化编辑器 -->
        <script type="text/javascript">
            var ue = UE.getEditor("['en']['content']");
        </script>
        {else/}
        <script type="text/javascript">
            var ue = UE.getEditor("['zh-CN']['content']");
        </script>
        {/if}
        {/foreach}

        <div class="layui-form-item">
            <label  class="layui-form-label">
            </label>
            <button  class="layui-btn" lay-filter="add" lay-submit="">
                增加
            </button>
        </div>
    </form>
</div>

<script>
    layui.use(['form','layer'], function(){
        $ = layui.jquery;
        var form = layui.form
            ,layer = layui.layer;

        //监听提交
        form.on('submit(add)', function(data){
            // var str = new Array(); //定义一数组
            // str = uri$('#intr').serialize();
            var formData = $("#intr").serialize();

            //发异步，把数据提交给php
            $.ajax({
                dataType : 'json',
                type : 'POST',
                url : '{:url("Conferhotel/add")}',
                async: false,
                data : formData,
                success : function(msg){
                    layer.alert(msg.msg, {icon: 6},function () {
                        window.parent.location.reload();
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                    });
                },
                error : function(XMLHttpRequest, textStatus, errorThrown) {
                    alert(XMLHttpRequest.status + "," + textStatus);
                }
            });

            return false;
        });

    });

</script>
{include file="./layout/footer.html" /}